home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Suzy B Software 2
/
Suzy B Software CD-ROM 2 (1994).iso
/
extras
/
programm
/
gemfsc20
/
gemfsc20.lzh
/
GEMFUNCS
/
FRMVFMT.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-02-01
|
1KB
|
51 lines
/**************************************************************************
* FRMVFMT.C - Allocate a 2k buffer, format text into it with vsprintf().
*************************************************************************/
#include "gemfintl.h"
#include <stdio.h>
static char GFAR errmsg[] = "\n"
"<Internal error: Can't get buffer to format message>"
"\n"
;
static char GFAR nullmsg[] = "\n"
"<Internal error: NULL format pointer>\n"
"\n"
;
void _FrmVFree(buffer)
char *buffer;
{
if (buffer != NULL && buffer != errmsg && buffer != nullmsg) {
apl_free(buffer);
}
}
char *_FrmVFormat(fmt, args, plen)
char *fmt;
va_list args;
short *plen;
{
char *buffer;
short len;
if (NULL == fmt) {
buffer = nullmsg;
len = gfErr_parameter_null;
} else if (NULL == (buffer = apl_malloc(2048L))) {
buffer = errmsg;
len = gfErr_no_memory;
} else {
len = vsprintf(buffer, fmt, args);
}
if (plen != NULL) {
*plen = len;
}
return buffer;
}